package com.liujun.spring4.demo.aop.iocset.xmlset.tagdepend;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

/**
 * 进行工厂方法测试
 *
 * @author liujun
 * @version 1.0
 * @date 2018-08-16 17:33:00
 */
public class BeanTagDepend {

  private ApplicationContext context;

  @BeforeClass
  private void start() {
    context =
        new ClassPathXmlApplicationContext(
                "com/liujun/spring4/demo/aop/iocset/xmlset/tagdepend/beanTagdepend.xml");
  }

  @Test
  public void getCar2() {
    Car car2 = (Car) context.getBean("car2");
    System.out.println(car2);
    Assert.assertNotNull(car2);
  }

  @Test
  public void getCar3() {
    Car car3 = (Car) context.getBean("car3");
    System.out.println(car3);
    Assert.assertNotNull(car3);
  }

  @Test
  public void cacheDepends() {
    CacheManager manage = (CacheManager) context.getBean("manager");
    System.out.println(SystemSettings.SSSION_TIMEOUT);
    System.out.println(SystemSettings.REFRESH_CYCLE);
    Assert.assertNotNull(manage);
  }

  public void carRes() {
    Boss boss = (Boss) context.getBean("bossus");
    System.out.println(boss);
    Assert.assertNotNull(boss);
  }

  @Test
  public void carId()
  {
      Boss boss = (Boss) context.getBean("bose");
      System.out.println(boss.getCarId());
      Assert.assertNotNull(boss);
  }
}
